package reflect;

import java.lang.reflect.Field;

public class ReflectDemo9 {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.Teacher");
        Object obj = cls.newInstance();

        Field field = cls.getDeclaredField("gender");
        field.setAccessible(true);
        field.set(obj,'男');
        System.out.println(obj);
    }
}
